package hn.cch.persistence.jdbc.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class JdbcService {

    private static final Logger logger = LoggerFactory.getLogger(JdbcService.class);

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Transactional
    public void testInsert(Object[] args) {
        // String sql = "insert into no_pk_table(column_name, column_name2) values (?,?)";
        String sql = "insert into pk_table(column_name, column_name2) values (?,?)";
        logger.info("start");
        int row = jdbcTemplate.update(sql, args);
        logger.info("row:{}", row);
    }

}
